# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=portablexdr
pkgver=4.9.1
pkgrel=2
pkgdesc="external data representation (XDR) library"
url="https://people.redhat.com/~rjones/portablexdr/"
arch="all"
license="GPL-2.0-or-later"
makedepends="libtool"
subpackages="$pkgname-dev $pkgname-rpcgen"
source="https://people.redhat.com/~rjones/portablexdr/files/portablexdr-$pkgver.tar.gz
	portablexdr-4.9.1-no-config-h.patch
	portablexdr-build-use-intptr_t-and-uintptr_t-to-cast-ptr-to-int.patch
	quad-types.patch
"

prepare() {
	default_prepare
	update_config_guess
	update_config_sub
}

build() {
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var

	make
}

package() {
	make DESTDIR="$pkgdir" install
	ln -s portable-rpcgen "$pkgdir"/usr/bin/rpcgen
}

rpcgen() {
	pkgdesc="Portable rpcgen"
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}

sha512sums="
47f2402e7ed9f2f518e2a45e76e8ad6c4b1e7ae1bd9408ca4dca3d0883697e755460ee64eef405e23b1840ad3b89ad54555bdf59dc8bae3cd8b67086d6ab3b1f  portablexdr-4.9.1.tar.gz
4d7dd2c6a40438ca9df8da93dad91295802ddd0cf51f4c2710a0213c34255f119a1c397c8aee9ffb6499baba2c3a39ce2f7ef5a46a2ce87cd8e881f8ab41d1c2  portablexdr-4.9.1-no-config-h.patch
f650a12897256a7194ec125dcac008b4a75b1907bfddcc34c4d23f40f93718072c9958b9eca7afeb1e356a64b5189d71077f765b5592b847d3473b2ee346ae8f  portablexdr-build-use-intptr_t-and-uintptr_t-to-cast-ptr-to-int.patch
8057db443cdb956945a40c2cf9d1f4d59086bd8affc819e36be146c50a7109bf18bd47e1ff69979d1e9187413d37836426b02cec6761987cf1c3483f6ed1f911  quad-types.patch
"
